package com.oa.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oa.dao.UserDao;
import com.oa.entity.User;
import com.oa.service.UserService;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {

	@Resource(name="userDao")
	private UserDao userDao ;
	
	//=================================================
	
	//查询所有用户
	public List<User> list() {
		return userDao.findAllEntity();
	}

	//添加用户
	public boolean add(User user) {
		return userDao.saveEntity(user);
	}

	//修改用户
	public boolean update(User user) {
		return userDao.updateEntity(user);
	}

	//撤销用户
	public boolean delete(User user) {
		return userDao.deleteEntity(user);
	}

	//根据ID 查询单个用户
	public User getById(String unique_id) {
		return userDao.getEntity(unique_id);
	}

	//初始化用户密码
	public boolean initPassword() {
		return false;
	}

	//判断用户登录
	public User findUserNameAndPass(User user) {
		return userDao.findUserNameAndPass(user);
	}

}
